package com.yoomiito.app.utils;

import com.blankj.rxbus.RxBus;
import com.yoomiito.app.base.BaseActivity;

import org.greenrobot.eventbus.Subscribe;

@Deprecated
public class RxBusManager {
    private static String DEFAULT_TAG = "RXBUS_DEFAULT_TAG";

    public static <T>void subscribeRxBusManager(final BaseActivity activity,RxBus.Callback<T> callback){

        RxBus.getDefault().subscribe(activity, callback);

    }

    public static <T>void subscribeRxBusManager(final BaseActivity activity,String tag,RxBus.Callback<T> callback){

        RxBus.getDefault().subscribe(activity, tag, callback);
    }


    public static void postToRxBusManager(final Object event) {
        RxBus.getDefault().post(event);
    }

    public static void postWithDefaultTagToRxBusManager(final Object event) {
        RxBus.getDefault().post(event, DEFAULT_TAG);
    }

    public static void postWithTagToRxBusManager(final Object event,String tag) {
        RxBus.getDefault().post(event, tag);
    }

    public static void postStickyToRxBusManager(final Object event) {
        RxBus.getDefault().postSticky(event);
    }

    public static void postStickyWithDefaultTagToRxBusManager(final Object event) {
        RxBus.getDefault().postSticky(event, DEFAULT_TAG);
    }

    public static void unregisterRxBusManager(final BaseActivity activity) {
        RxBus.getDefault().unregister(activity);
    }
}
